<?php

namespace App\Observers;

// creating, created, updating, updated, saving,
// saved,  deleting, deleted, restoring, restored

use App\Handlers\RedisHandler;
use Encore\Admin\Config\ConfigModel;


class ConfigObserver
{
    public function saved(ConfigModel $model)
    {
        RedisHandler::saveModel($model,"config:{$model->name}");
    }

    public function deleted(ConfigModel $model)
    {
        app('redis')->del(["config:{$model->name}"]);
    }
}